package apps.sim.util.thread;

import java.util.Random;

public class ServiceExecutor extends CallableTask<ServiceProxy> {
	private final ServiceProxy serviceProxy;

	public ServiceExecutor(ServiceProxy serviceProxy) {
		this.serviceProxy = serviceProxy;
	}

	@Override
	protected ServiceProxy execute() throws Exception {
		serviceProxy.setStart();
		final long millis = new Random().nextInt(10)* 1000L;
		Thread.sleep(millis);
		serviceProxy.setEnd();
		return serviceProxy;
	}

}
